class CreatePages < ActiveRecord::Migration
  def self.up
    create_table :pages do |t|
      t.string    :title, :null=>false
      t.string    :slug, :limit=>50, :null=>false
      t.text      :content, :limit=>2.megabytes
      t.integer   :structure_id, :null=>false
      
      t.timestamps
    end
    
    add_index :pages, :structure_id, :name=>"fk_structure"
    add_index :pages, :slug, :name=>"idx_slug"
    
    Page.create_translation_table! :title => :string, :content=>:text
  end

  def self.down
    drop_table :pages
    Page.drop_translation_table!
  end
end
